import React from 'react'
import { Form, Button, Select, Row, Col } from "antd";

const { Option } = Select;

const SelectModule = ({handleSelectModuleOk, handleSelectModuleReset}) => {
    const [form] = Form.useForm()
    const {resetFields} = form
    const handleReset = () => {
        resetFields()
        handleSelectModuleReset()
    }
    const onFinish = (values) => {
        handleSelectModuleOk(values)
    };
    return <Form
        {...layout}
        name="basic"
        initialValues={{ remember: true }}
        onFinish={onFinish}
        form={form}
    >
        <Row>
            <Col span={8}>
                <Form.Item name="state" label="规则状态" hasFeedback>
                    <Select placeholder="请选择规则状态">
                        <Option value={0}> 禁用 </Option>
                        <Option value={1}> 启用 </Option>
                    </Select>
                </Form.Item>
            </Col>
        </Row>
        <Row>
            <Col span={20}></Col>
            <Col span={4}>
                <Form.Item {...tailLayout}>
                    <Button onClick={handleReset}>重置</Button>
                    <Button type="primary" htmlType="submit">
                        确定
                    </Button>
                </Form.Item>
            </Col>
        </Row>
    </Form>
}
const layout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};

const tailLayout = {
    wrapperCol: { offset: 8, span: 16 },
};

export default SelectModule